import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { PageNotFoundComponent } from "./page-not-found/page-not-found.component";
import { SelectivePreloadingStrategyService } from "./selective-preloading-strategy.service";
import { ImportComponent } from "./import/import.component";
import { OutputdesignComponent } from "./outputdesign/outputdesign.component";
import { OutputdesigndtoComponent } from "./outputdesign/outputdesigndto/outputdesigndto.component";
import { OutputdesignclassComponent } from "./outputdesign/outputdesignclass/outputdesignclass.component";
import { OutputdesignotherdtoComponent } from "./outputdesign/outputdesignotherdto/outputdesignotherdto.component";
import { OutputdesignothersComponent } from "./outputdesign/outputdesignothers/outputdesignothers.component";
import { OutputdesigndownloadComponent } from "./outputdesign/outputdesigndownload/outputdesigndownload.component";
import { ImportedfilesListComponent } from "./imported-files/imported-files-list/imported-files-list.component";
import { ImageItemDetailComponent } from "./imported-files/image-item-detail/image-item-detail.component";
import { CreateSourceComponent, CreateClassComponent } from "./create";
import { CommonComponent } from "./common";
import { TranslateComponent } from "./common/translate";

const appRoutes: Routes = [
  {
    path: "import",
    component: ImportComponent,
  },
  {
    path: "outputdesign",
    component: OutputdesignComponent,
    children: [
      {
        path: "",
        redirectTo: "outputdesigndto",
        pathMatch: "full",
      },
      {
        path: "outputdesigndto",
        component: OutputdesigndtoComponent,
      },
      {
        path: "outputdesignclass",
        component: OutputdesignclassComponent,
      },
      {
        path: "outputdesignotherdto",
        component: OutputdesignotherdtoComponent,
      },
      {
        path: "outputdesignothers",
        component: OutputdesignothersComponent,
      },
      {
        path: "outputdesigndownload",
        component: OutputdesigndownloadComponent,
      },
    ],
  },
  {
    path: "createsource",
    component: CreateSourceComponent,
  },
  {
    path: "createclass",
    component: CreateClassComponent,
  },
  {
    path: "importedfiles",
    component: ImportedfilesListComponent,
    data: { animation: "importedfiles" },
  },
  {
    path: "importedfilesdetail/:id",
    component: ImageItemDetailComponent,
    data: { animation: "importedfile" },
  },
  {
    path: "common",
    component: CommonComponent,
    children: [
      {
        path: "",
        redirectTo: "translate",
        pathMatch: "full",
      },
      {
        path: "translate",
        component: TranslateComponent,
      },
    ],
  },
  { path: "", redirectTo: "/createsource", pathMatch: "full" },
  { path: "**", component: PageNotFoundComponent },
];

@NgModule({
  imports: [
    RouterModule.forRoot(appRoutes, {
      enableTracing: false, // <-- debugging purposes only
      preloadingStrategy: SelectivePreloadingStrategyService,
    }),
  ],
  exports: [RouterModule],
})
export class AppRoutingModule {}
